package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.MallBannerEntity;
import com.zw.yzk.kabu.model.BannerModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/2/26.
 */

public class BannerMapper {

    @Inject
    public BannerMapper() {

    }

    public BannerModel transfer(MallBannerEntity.Item item) {
        BannerModel model = new BannerModel();
        model.setId(item.id);
        model.setImageUrl(item.image);
        model.setOrder(item.order);
        model.setPageUrl(item.link);

        return model;
    }

    public List<BannerModel> transfer(MallBannerEntity entityList) {
        List<BannerModel> models = new ArrayList<>();
        for (MallBannerEntity.Item entity : entityList.result.bannerList) {
            models.add(transfer(entity));
        }

        return models;
    }
}
